Many data management systems allow the size of a data file to grow as the amount of data stored in the file increases beyond its initial allocated size. In most systems, the file is logically subdivided into pages which are addressed by multiplying the page number by the page size. Increasing the size of a file is a simple operation as new pages are appended to the end of the file.
On the other hand, deletions from the file mean that the file size is larger than is required to hold its data. Unfortunately, reducing the size of a file is difficult since deletions usually occur randomly throughout the file. While it is possible to move data from one page to another to fill the holes in the file left by deletion, changing the physical location of a page within the file requires that the page number be modified. Therefore, shrinking a file's size has previously required unloading the file, deleting and recreating the file, and reloading the data. All of these operations must be performed when there are no database users present to prevent corrupted data. Preventing user access to the database during the shrinking process can range from merely inconvenient, in the case of a small file, to highly disruptive.
Therefore, there is a need in the art for a mechanism to reduce the physical size of a data file while the data in the file is being read and updated by on-line users